{% extends "admin/common/base.html" %}<!--继承基础模板-->
{% block content %}<!--自定义模板区域-->
<div class="col-xs-12 col-sm-12">
    <p class="pull-right visible-xs">
        <button type="button" class="btn btn-primary btn-xs" data-toggle="offcanvas">Toggle nav</button>
    </p>
    <div class="jumbotron">
        <h1>自动邮件分发管理系统</h1>
        <p>{{current_user.name}},你可以导入资料分发邮件发送.</p>
    </div>
    <div class="row">
        <div class="col-xs-6 col-lg-4">
            <h2>导入分发邮件</h2>

            <form action="/admin/upload" method="post" enctype="multipart/form-data">
                <div class="form-group">
                    {{ form.file.label }}{{ form.file }}
                </div>
                <div class="form-group">
                    {{ form.submit }}
                </div>
            </form>
        </div><!--/.col-xs-6.col-lg-4-->
        <div class="col-xs-6 col-lg-4">
            <h2>邮件信息</h2>
            <p>总量：{{email_data.total}}</p>
            <p>未分配：{{email_data.not_used_total}} <a href="{{email_data.distribute_url}}">分发邮件</a></p>
            <p>已分配：{{email_data.used_total}}</p>
        </div><!--/.col-xs-6.col-lg-4-->
        <div class="col-xs-6 col-lg-4">
            <h2>文件导入记录</h2>
            <table class="table" style="height:150px">
                <caption>导入记录</caption>
                <thead>
                <tr>
                    <th>ID</th>
                    <th>用户ID</th>
                    <th>管理ID</th>
                    <th>文件</th>
                    <th>时间</th>
                </tr>
                </thead>
                <tbody>
                {% for log in upload_log %}
                <tr>
                    <td>{{log.id}}</td>
                    <td>{{log.user_id}}</td>
                    <td>{{log.admin_user_id}}</td>
                    <td>{{log.file_path}}</td>
                    <td>{{log.create_time}}</td>
                </tr>
                {% endfor %}
                </tbody>
            </table>
        </div><!--/.col-xs-6.col-lg-4-->
        <div class="col-xs-6 col-lg-6">
            <h2>运营用户信息</h2>
            <p>总数：{{operator.total}}</p>
            <div class="table-responsive">
                <table class="table">
                    <caption>运营账号</caption>
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>姓名</th>
                        <th>邮箱</th>
                        <th>状态</th>
                        <th>注册时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for user in operator.users %}
                    <tr>
                        <td>{{user.id}}</td>
                        <td>{{user.name}}</td>
                        <td>{{user.email}}</td>
                        <td>{{user.active}}</td>
                        <td>{{user.create_time}}</td>
                    </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div><!--/.col-xs-6.col-lg-4-->
        <div class="col-xs-6 col-lg-6">
            <h2>运营者分发情况</h2>
            <p>总发送：{{operator.send_total}} 待发送：{{operator.wait_send_total}}</p>
            <table class="table">
                <caption>运营情况</caption>
                <thead>
                <tr>
                    <th>ID</th>
                    <th>姓名</th>
                    <th>邮箱</th>
                    <th>已发送</th>
                    <th>待发送</th>
                </tr>
                </thead>
                <tbody>
                {% for user in operator.users %}
                <tr>
                    <td>{{user.id}}</td>
                    <td>{{user.name}}</td>
                    <td>{{user.email}}</td>
                    <td>{{user.send_total}}</td>
                    <td>{{user.wait_send_total}}</td>
                </tr>
                {% endfor %}
                </tbody>
            </table>
        </div><!--/.col-xs-6.col-lg-4-->

        <!--        <div class="col-xs-6 col-lg-4">-->
        <!--            <h2>Heading</h2>-->
        <!--            <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris-->
        <!--                condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis-->
        <!--                euismod. Donec sed odio dui. </p>-->
        <!--            <p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>-->
        <!--        </div>&lt;!&ndash;/.col-xs-6.col-lg-4&ndash;&gt;-->
    </div><!--/row-->
</div><!--/.col-xs-12.col-sm-9-->
{% endblock %}